<template>
  <div>
    <table class="layui-table">
      <colgroup>
        <col width="150" />
        <col width="200" />
        <col />
      </colgroup>
      <thead>
        <tr>
          <th style="width: 70%">帖子标题</th>
          <th style="text-align: end">收藏时间</th>
        </tr>
      </thead>
      <tbody>
        <tr
          class="textcenter"
          v-for="(item, index) in collect"
          :key="'collect' + index"
        >
          <td>
            <router-link
              :class="{ detail: item.title }"
              :to="{ name: 'detail', params: { tid: item.tid } }"
              >{{ item.title }}</router-link
            >
          </td>
          <td style="text-align: end">{{ item.created | moment }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
import { getcollect } from '@/api/user'
export default {
  name: 'collect',
  components: {

  },
  props: [],

  data () {
    return {
      collect: ''
    };
  },
  computed: {

  },
  created () {

  },
  mounted () {
    this.getColl()
  },
  watch: {

  },
  methods: {
    getColl () {
      getcollect({
        uid: this.$store.state.userInfo._id
      }).then((res) => {
        if (res.code === 200) {
          this.collect = res.data
          console.log(this.collect);
        }
      })
    }
  },
};
</script>

<style scoped lang="scss">
.detail {
  color: #01aaed;
}
</style>
